import request from "@/request/";

export const getList = (data) => {
  return request({
    url: "/api/trio-system/user/mes/page",
    method: "post",
    data,
  });
};

export const remove = (ids) => {
  return request({
    url: "/api/trio-system/user/mes/remove",
    method: "post",
    params: {
      ids,
    },
  });
};

export const add = (row) => {
  return request({
    url: "/api/trio-system/user/mes/submit",
    method: "post",
    data: row,
  });
};

export const updatePlatform = (userId, userType, userExt) => {
  return request({
    url: "/api/trio-user/update-platform",
    method: "post",
    params: {
      userId,
      userType,
      userExt,
    },
  });
};

export const getUser = (id) => {
  return request({
    url: "/api/trio-system/user/mes/detail",
    method: "post",
    data: {
      id,
    },
  });
};

export const getUserPlatform = (id) => {
  return request({
    url: "/api/trio-user/platform-detail",
    method: "get",
    params: {
      id,
    },
  });
};

export const getUserInfo = () => {
  return request({
    url: "/api/trio-user/info",
    method: "get",
  });
};

export const resetPassword = (userIds) => {
  return request({
    url: "/api/trio-system/user/mes/reset-password",
    method: "post",
    params: {
      userIds,
    },
  });
};

export const updatePassword = (oldPassword, newPassword, newPassword1) => {
  return request({
    url: "/api/trio-system/user/mes/update-password",
    method: "post",
    params: {
      oldPassword,
      newPassword,
      newPassword1,
    },
  });
};

export const updateInfo = (row) => {
  return request({
    url: "/api/trio-user/update-info",
    method: "post",
    data: row,
  });
};

export const grant = (userIds, roleIds) => {
  return request({
    url: "/api/trio-system/user/mes/grant",
    method: "post",
    params: {
      userIds,
      roleIds,
    },
  });
};

export const unlock = (userIds) => {
  return request({
    url: "/api/trio-user/unlock",
    method: "post",
    params: {
      userIds,
    },
  });
};

export const savaFact = (data) => {
  return request({
    url: "/api/trio-system/user/mes/factory/save",
    method: "post",
    data,
  });
};
